--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_yakumo_yukari = General:new(extension, "hy_yakumo_yukari", "ten_k", 3, 3, General.Female)
    local vanish = fk.CreateSkill {
        name = "vanish",
    }
    vanish:addEffect("active", {
        anim_type = "control",
        max_card_num = 1,
        card_filter = function(self, player, to_select, selected)
            return #selected == 0 and not table.contains(player.player_cards[Player.Equip], to_select)
        end,
        target_num = 1,
        target_filter = function(self, player, to_select, selected, selected_cards)
            if #selected > 0 or player == to_select then
                return false
            end
            return (#to_select.player_cards[Player.Equip] > 0 or #to_select.player_cards[Player.Judge] > 0) or #selected_cards > 0
        end,
        can_use = function(self, player)
            return player:usedSkillTimes(vanish.name, Player.HistoryPhase) == 0
        end,
        prompt = function(self, selected, selected_cards)
            return "vanish_prompt"
        end,
        on_use = function(self, room, cardUseEvent)
            local player = cardUseEvent.from
            local target = cardUseEvent.tos[1]
            if not target.dead then
                room:drawCards(target, 2, vanish.name)
            end
            if #cardUseEvent.cards > 0 then
                room:moveCardTo(Fk:getCardById(cardUseEvent.cards[1]), Card.DrawPile, target, fk.ReasonPut, vanish.name)
            else
                local cardId = room:askToChooseCard(player, {
                    target = target,
                    flag = "ej",
                    skill_name = vanish.name
                })
                room:moveCardTo(Fk:getCardById(cardId), Card.DrawPile, target, fk.ReasonPut, vanish.name)
            end
            player:turnOver()
            target:turnOver()
        end,
    })
    local lapras = fk.CreateSkill {
        name = "lapras",
    }
    lapras:addEffect(fk.FinishJudge, {
        anim_type = "defensive",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(lapras.name) and player:usedSkillTimes(lapras.name, Player.HistoryTurn) == 0 and data.card and player.room.current.phase ~= Player.NotActive
        end,
        on_cost = function(self, event, target, player)
            return player.room:askToSkillInvoke(player, {
                skill_name = lapras.name,
                prompt = "lapras_prompt"
            })
        end,
        on_use = function(self, event, target, player, data)
            if player.room:getCardArea(data.card.id) == Card.Processing then
                player.room:obtainCard(player, data.card, true, fk.ReasonPrey)
                data.card = nil
                player.room:judge(data)
            end
        end
    })
    local life_and_death = fk.CreateSkill {
        name = "life_and_death",
    }
    life_and_death:addEffect(fk.RoundStart, {
        can_trigger = function(self, event, target, player)
            if not player:hasSkill(life_and_death.name) then
                return false
            end
            local room = player.room
            return table.every(room.alive_players, function(t)
                return t:getMark("@@life_and_death") == 0
            end)
        end,
        on_cost = function(self, event, target, player)
            local room = player.room
            event:setCostData(self, table.map(room:askToChoosePlayers(player, {
                targets = room.alive_players,
                min_num = 1,
                max_num = 1,
                prompt = "life_and_death_prompt",
                skill_name = life_and_death.name
            }), Util.IdMapper))
            return #event:getCostData(self) > 0
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:setPlayerMark(room:getPlayerById(event:getCostData(self)[1]), "@@life_and_death", 1)
        end,
    })
    life_and_death:addEffect(fk.Damaged, {
        can_trigger = function(self, event, target, player)
            if not player:hasSkill(life_and_death.name) then
                return false
            end
            return target:getMark("@@life_and_death") > 0
        end,
        on_cost = function(self, event, target, player)
            local room = player.room
            return room:askToSkillInvoke(player, {
                skill_name = life_and_death.name,
                prompt = "life_and_death_yang_prompt::" .. target.id
            })
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:setPlayerMark(target, "@@life_and_death", 0)
            room:changeShield(target, 1)
        end,
    })
    life_and_death:addEffect(fk.HpRecover, {
        can_trigger = function(self, event, target, player)
            if not player:hasSkill(life_and_death.name) then
                return false
            end
            return target:getMark("@@life_and_death") > 0
        end,
        on_cost = function(self, event, target, player)
            local room = player.room
            return room:askToSkillInvoke(player, {
                skill_name = life_and_death.name,
                prompt = "life_and_death_yin_prompt::" .. target.id
            })
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:setPlayerMark(target, "@@life_and_death", 0)
            room:loseHp(target, 1, life_and_death.name)
        end,
    })
    life_and_death:addEffect(fk.Deathed, {
        can_refresh = function(self, event, target, player, data)
            return player:hasSkill(life_and_death.name, true, true) and target == player
        end,
        on_refresh = function(self, event, target, player, data)
            for _, t in ipairs(player.room.players) do
                player.room:setPlayerMark(t, "@@life_and_death", 0)
            end
        end
    })
    extension:loadSkillSkels { vanish, lapras, life_and_death }
    hy_yakumo_yukari:addSkill("vanish")
    hy_yakumo_yukari:addSkill("lapras")
    hy_yakumo_yukari:addSkill("life_and_death")
    Fk:loadTranslationTable {
        ["hy_yakumo_yukari"] = "八云紫",
        ["#hy_yakumo_yukari"] = "通古晓今的诡秘",
        ["illustrator:hy_yakumo_yukari"] = "ねるぞう",
        ["designer:hy_yakumo_yukari"] = "黑曜人形",
        ["cv:hy_yakumo_yukari"] = "",

        ["vanish"] = "神隐",
        [":vanish"] = "出牌阶段限一次，你可以令一名其他角色摸两张牌，然后将该角色场上一张牌或你的一张手牌置于牌堆顶。若如此做，你与该角色翻面。",
        ["vanish_prompt"] = "神隐：你可以令一名其他角色摸两张牌并翻面",

        ["lapras"] = "魔眼",
        [":lapras"] = "每回合限一次，一名角色判定生效前，你可以获得判定牌并令其重新判定。",
        ["lapras_prompt"] = "魔眼：你可以获得此判定牌并重新进行判定",

        ["life_and_death"] = "生死",
        [":life_and_death"] = "每轮开始时，若场上没有“生死”标记，你可以令一名角色获得“生死”标记。有“生死”标记的角色受到伤害后/回复体力后，你可以移去此标记然后令其获得1点护甲/失去1点体力。",
        ["@@life_and_death"] = "生死",
        ["life_and_death_prompt"] = "生死：你可以令一名角色获得“生死”标记",
        ["life_and_death_yang_prompt"] = "生死：你可以令%dest获得1点护甲",
        ["life_and_death_yin_prompt"] = "生死：你可以令%dest失去1点体力",
    }
end
